#!/usr/bin/env python
# -*- coding: utf-8 -*-

from typing import Any

from cta.interface.action.transaction_date.abstract_transaction_date_action import AbstractTransactionDateAction
from cta.interface.step.abstract_step import AbstractStep
from web.domain.responsibility_chain_dto import ResponsibilityChainDto


class TransactionDateStep(AbstractStep):
    """
    交易日期步骤
    """

    def __init__(self, transaction_date_action: AbstractTransactionDateAction, successor=None):
        super().__init__(successor)
        self.transaction_date_action = transaction_date_action

    def set_successor(self, successor):
        super().set_successor(successor)

    def exec(self, responsibility_chain_dto: ResponsibilityChainDto = None) -> list:
        transaction_date_list: list = self.transaction_date_action.exec()
        return [transaction_date_tuple for transaction_date_tuple in transaction_date_list]
